﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Diagnostics;
using QuanLyKho.Server;
using QuanLyKho.Properties;
using DevExpress.Xpf.Core;
using QuanLyKho.CommonControl;

namespace QuanLyKho
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                DXSplashScreen.Show<SplashScreenProcessBar>();
                // Get config information from app.config file
                string datasource = Settings.Default.DATASOURCE;
                string dbname = Settings.Default.DBNAME;
                string username = Settings.Default.USERNAME;
                string password = Settings.Default.PASSWORD;
                string connectionString = ConfigurationManager.ConnectionStrings["QuanLyKhoEntities"].ToString();
                QuanLyKhoServerGlobal.SetConnectionCommon(datasource, dbname, username, password, connectionString);
                var mainView = new MainWindow();
                mainView.Show();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
    }
}
